<?php
require_once ('../lib/config.php');
require_once ('../lib/facebook.php');
require_once ('../lib/friends.php');
require_once ('../lib/friend.php');
require_once ('../lib/test.php');
require_once ('../../simpletest/autorun.php');
require_once ('../lib/init.php');

class TestFunc_getMessage extends UnitTestCase {
    
    function setUp(){
        global $login_button,$facebook;
        
        if(isLoggedIn()){
            try{
                $me = getOneself();
            }catch(Exception $e){
                print($login_button);
                exit();
            }
        }
    }
    
    //refer to http://www.simpletest.org/en/unit_test_documentation.html
    function test_getMessage(){ 
        try{
            $data = getMessage();
        
            //not null
            $this->assertNotNull($data);
            
            //contain two result sets
            $this->assertTrue(count($data) == 2);
            
            //contain messageQuery and threadQuery
            $this->assertNotNull(getResultSet('messageQuery', $data));
            $this->assertNotNull(getResultSet('threadQuery', $data));

            print_r($data);
            
        }catch(Exception $e){
			$this->asserTrue(false);
            print_r($e);
        }
        
        
    }
}
?>
